package huoye.shops.huoye.operation.activity;

import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

import java.util.Date;

import butterknife.BindView;
import butterknife.OnClick;
import huoye.shops.R;
import huoye.shops.base.BaseActivity;
import huoye.shops.huoye.operation.widget.EventCodeDialog;
import huoye.shops.utils.ViewUtils;

import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static huoye.shops.utils.StockUtils.setTimeStyle;

public class BuildEventDetailsActivity extends BaseActivity{

    @BindView(R.id.build_event_details_tv_rule)
    TextView tvRule;

    @BindView(R.id.build_event_details_tv_residue_time_day)
    TextView tvTimeOne;
    @BindView(R.id.build_event_details_tv_residue_time_hout)
    TextView tvTimeTwo;
    @BindView(R.id.build_event_details_tv_residue_time_minute)
    TextView tvTimeThree;

    @OnClick(R.id.build_event_details_btn_cancel)
    void onCancelClick(){

    }

    @OnClick(R.id.build_event_details_btn_affirm)
    void onAffirmClick(){

    }


    @Override
    protected int getContentViewId() {
        return R.layout.activity_build_event_details;
    }

    @Override
    protected void initView(@Nullable Bundle bundle) {
        setTitle("自建活动");
        setRightTv("活动二维码");
        showRightBtn();

    }

    @Override
    public void onTopRightIvClick() {
        super.onTopRightIvClick();
        EventCodeDialog eventCodeDialog = new EventCodeDialog(this);
        eventCodeDialog.show();
        eventCodeDialog.encode("我是张扬波");

    }


    private void  showDistanceTime(Date endDate){
        Date now = new Date();

        long hour = ViewUtils.getDistanceTimeHourDay(now, endDate);
        long min = ViewUtils.getDistanceTimemin(now, endDate);
        long second = ViewUtils.getDistanceTimeSecond(now, endDate);

        if(hour == 0 && min == 0 ) {
            tvTimeOne.setText("00");
            tvTimeTwo.setText("00");
            tvTimeThree.setText(setTimeStyle(second));
        } else if(hour == 0 ) {
            tvTimeOne.setText("00");
            tvTimeTwo.setText(setTimeStyle(min));
            tvTimeThree.setText(setTimeStyle(second));
        } else {
            tvTimeOne.setText(setTimeStyle(hour));
            tvTimeTwo.setText(setTimeStyle(min));
            tvTimeThree.setText(setTimeStyle(second));
        }
    }

}
